home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 117
/
117.d81
/
toolbox 117.s
< prev
next >
Wrap
Text File
|
2022-08-26
|
21KB
|
2,039 lines
open =$ffc0
readst =$ffb7
setlfs =$ffba
setnam =$ffbd
setmsg =$ff90
load =$ffd5
getin =$ffe4
input'buffer =512
clrchn =$ffcc
close =$ffc3 ;a
chrin =$ffcf
chkout =$ffc9 ;x
chkin =$ffc6 ;x
plot =$fff0
chrout =$ffd2
color'pointer =243
screen'line'pointer =209
print'number =$bdcd ;x,a
clear'line =59903
background =53281
border =53280
strout = $ab1e; .A low .Y high
unlisten =$ffae
clall =$ffe7
color1 =53282
color2 =53283
color3 =53284
white =5
crsr'down =17
rvs'on =18
home =19
del =20
red =28
crsr'right =29
green =30
blue =31
black =144
lowercase =14
uppercase =142
crsr'up =145
rvs'off =146
clr =147
insert =148
brown =149
light'red =150
dark'grey =151
medium'grey =152
light'green =153
light'blue =154
light'grey =155
purple =156
crsr'left =157
yellow =158
cyan =159
top'left =176
top'right =174
bottom'left =173
bottom'right =189
.org $9000
.obj "toolbox117 9000"
;mem
jmp menu'entry
jmp box'entry;; 3
jmp screen'stash; 6
jmp screen'restore;9
jmp linx; 12
jmp print'at;15
jmp center;18
jmp ucase;21
jmp lcase;24
jmp load'file;27
jmp read'existing;30
jmp screen'merge;33
jmp char'swap;36
jmp color'swap;39
jmp shade'area;42
jmp directory;45
jmp brancher;48
jmp bload;51
jmp frame'entry;54
jmp get'scroll'up;57
jmp get'scroll'down;60
jmp clear'row;63
;sys,addr y,x1,x2,number items,text,highlight,esc
;***sys addr,x,to x,y,to y,s-code,color
box'entry lda #5
sta parm'count
lda #0
sta shade
box'ii lda #0
sta temp
- jsr get'number
tya
ldy temp
sta box'parameters,y
inc temp
cpy parm'count
bne -
fill'box jsr linx
lda 214
pha
lda 211
pha
box'start ldx box'parameters+2
ldy #0
clc
jsr $fff0
jsr old'rom'patch
dec box'parameters
;inc box'parameters+3
- ldy box'parameters+1
- lda box'parameters+4
bit shade
bmi get'shade
cmp #255
beq +
sta (209),y
+ lda box'parameters+5
store'color sta (243),y
dey
cpy box'parameters
bne -
lda 214
cmp box'parameters+3
beq +
inc 214
jsr 58732
jsr old'rom'patch
jmp --
+ lda #home
jsr $ffd2
pla
sta 211
pla
sta 214
lda #0
sta shade
jmp 58732
linx ldy #24
- lda 217,y
ora #128
sta 217,y
dey
bpl -
rts
get'shade lda (243),y
and #15
tax
lda shade'table,x
jmp store'color
screen'stash sec
jsr plot
stx menuy
sty menux1
jsr get'number
sty 252
tya
cpy >1024
bcs +
rts
+ clc
adc #4
sta 254
lda #0
sta 253
sta 251
lda #home
jsr chrout
jsr old'rom'patch
sei
lda #0
sta 1
ldx #3
ldy #0
- lda (209),y
sta (251),y
dec 1
lda (243),y
inc 1
sta (253),y
iny
bne -
inc 210
inc 252
inc 244
inc 254
dex
bpl -
dec 254
ldy #233
dec 1
lda 53280
inc 1
sta (253),y
iny
dec 1
lda 53281
inc 1
sta (253),y
iny
lda menuy
sta (253),y
iny
lda menux1
sta (253),y
lda #$77
sta 1
cli
ldy menux1
ldx menuy
clc
jmp plot
screen'restore lda #0
sta merge
restore'ii jsr get'number
sty 252
tya
clc
adc #4
sta 254
lda #0
sta 253
sta 251
lda #home
jsr chrout
jsr old'rom'patch
sei
lda #0
sta 1
ldx #3
ldy #0
- lda (209),y
sta temp
bit merge
bpl no'merge
lda temp
and #%10111111
cmp #32
bne skip
no'merge lda (251),y
sta (209),y
lda (253),y
dec 1
sta (243),y
inc 1
skip iny
bne -
inc 210
inc 252
inc 244
inc 254
dex
bpl -
dec 254
bit merge
bmi rest'out
ldy #233
lda (253),y
dec 1
sta 53280
iny
inc 1
lda (253),y
dec 1
sta 53281
inc 1
iny
lda (253),y
sta 214
iny
lda (253),y
sta 211
rest'out lda #$77
sta 1
lda #0
sta merge
cli
jmp 58732
menu'entry lda #0
sta 253
sta 254
sta temp
sta flag
- jsr get'number
tya
ldy temp
sta menuy,y
inc temp
cpy #5
bne -
jsr get'string
cmp #25
bcc +
lda #25
+ sta base
ldy #0
- lda ($22),y
sta wordbuf,y
iny
cpy base
bne -
;lda #0
;sta wordbuf,y
menu jsr linx
ldx menuy
ldy #0
sty menu'current
clc
jsr plot
jsr old'rom'patch
lda menu'highlight
sta mcolor
jsr paint'line
menu'wait jsr getin
beq menu'wait
ldx #0
sta flag
ldx menu'current
stx temp
cmp #crsr'down
beq menu'down
cmp #crsr'up
beq menu'up
jsr check'hotkeys
cmp #13
beq menu'select
bne menu'wait'loop
menu'wait'loop jmp menu'wait
menu'down inc menu'current
lda menu'current
cmp menu'items
bne highlight
lda #0
sta menu'current
jmp highlight
menu'up dec menu'current
lda menu'current
cmp #255
beq +
jmp highlight
+ ldy menu'items
dey
sty menu'current
jmp highlight
menu'select lda flag
beq +
lda temp
jmp ++
+ lda menu'current
+ clc
adc menuy
tax
ldy #0
jsr plot
jsr old'rom'patch
lda menu'text
sta mcolor
jsr paint'line
lda menu'current
clc
adc #1
sta box'parameters
lda #0
sta box'parameters+1
jmp make'variable
highlight lda menuy
clc
adc menu'current
tax
ldy #0
clc
jsr plot
jsr old'rom'patch
lda menu'highlight
sta mcolor
jsr paint'line
lda menuy
clc
adc temp
tax
ldy #0
clc
jsr plot
jsr old'rom'patch
lda menu'text
sta mcolor
jsr paint'line
jmp menu'wait
paint'line ldy menux1
- lda mcolor
sta (243),y
bmi +
lda (209),y
eor #128
sta (209),y
+ iny
cpy menux2
beq -
bcc -
rts
check'hotkeys tax
tya
pha
ldy #0
txa
- cmp wordbuf,y
bne +
sty menu'current
ldx #13
stx flag
+ iny
cpy base
bne -
+ pla
tay
txa
rts
;**** get number from BASIC ****
get'number jsr $aefd
jsr $ad8a
jmp $b7f7
;***** get string from BASIC ****
get'string jsr $aefd
jsr $ad9e
jsr $b6a3
ldx $22
ldy $23
rts
print'at jsr linx
jsr get'number
sty 211
jsr get'number
sty 214
jsr 58732
jsr get'string
sta temp
print'string lda temp
beq +
ldy #0
- lda ($22),y
jsr chrout
iny
cpy temp
bne -
+ rts
ucase jsr get'string
cmp #0
beq uout
sta temp
ldy #0
- lda ($22),y
cmp #65
bcc +
ora #128
sta ($22),y
+ iny
cpy temp
bne -
uout rts
lcase jsr get'string
sta temp
cmp #0
beq +
ldy #0
- lda ($22),y
and #127
sta ($22),y
iny
cpy temp
bne -
/ rts
center jsr get'number
tya
tax
ldy #0
clc
jsr plot
jsr get'string
mcenter sta temp
lsr
sta flag
lda #20
sec
sbc flag
sta 211
jsr 58732
jmp print'string
old'rom'patch lda 210
sec
sbc 648
clc
adc #$d8
sta 244
lda 209
sta 243
rts
screen'merge lda #255
sta merge
jmp restore'ii
char'swap jsr get'number
sty menuy
jsr get'number
sty menuy+1
jsr get'number
sty menuy+2
jsr linx
lda #19
jsr chrout
jsr old'rom'patch
lda #24
sta 251
- ldy #39
- lda (209),y
cmp menuy
bne no'match
lda menuy+1
sta (209),y
lda menuy+2
bmi no'match
sta (243),y
no'match dey
bpl -
dec 251
bmi swap'out
lda #40
clc
adc 209
sta 209
lda #0
adc 210
sta 210
clc
lda #40
adc 243
sta 243
lda #0
adc 244
sta 244
jmp --
swap'out lda #19
jmp chrout
color'swap jsr get'number
sty menuy
jsr get'number
sty menuy+1
jsr linx
lda #19
jsr chrout
jsr old'rom'patch
lda #24
sta 251
- ldy #39
- lda (243),y
and #15
cmp menuy
bne no'matchc
lda menuy+1
sta (243),y
no'matchc dey
bpl -
dec 251
bmi swap'out
clc
lda #40
adc 243
sta 243
lda #0
adc 244
sta 244
jmp --
shade'area lda #3
sta parm'count
lda #255
sta shade
jmp box'ii
directory jsr get'string
jsr setnam
jsr get'number
tya
tax
lda #2
ldy #0 ; must be 0 for directory
jsr setlfs
jsr open
jsr clrchn
ldx #2
jsr chkin
jsr getin ;skip unused bytes
jsr getin
jsr getin
jsr getin
get'blocks jsr getin
sta 251
jsr getin
ldx 251
jsr print'number ;$bdcd. part of list command
lda " "
jsr chrout
jsr chrout
get'name lda 653
bne get'name
jsr getin
beq next'name
jsr chrout
jsr readst
and #66
bne end'dir
beq get'name
next'name jsr getin
beq end'dir
jsr getin
lda #13
jsr chrout
jmp get'blocks
end'dir lda #2
jsr close
jmp clrchn
brancher jsr get'string
sta 252
- jsr getin
beq -
ldy #0
- cmp ($22),y
bne +
iny
tya
sta box'parameters
lda #0
sta box'parameters+1
jmp make'variable
+ iny
cpy 252
bne -
beq --
;store lsb in 253
;store msb in 254
;makes variable, f%
make'variable lda "f"
sta 251
lda "%"
sta 252
lda #0
sta 253
lda $7a
pha
lda $7b
pha
lda <251
sta $7a
lda >251
sta $7b
jsr $b08b
ldy #0
lda box'parameters+1 ;high byte
sta ($47),y
iny
lda box'parameters ;low byte
sta ($47),y
pla
sta $7b
pla
sta $7a
rts
bload jsr get'string
jsr setnam
jsr get'number
tya
tax
lda #2
ldy #0
jsr setlfs
jsr get'number
sty base
sta base+1
ldx $14
ldy $15
lda #0
jmp load
do'box stx 251
sty 252
ldy #5
- lda (251),y
sta box'parameters,y
dey
bpl -
jmp fill'box
do'frame stx 251
sty 252
ldy #4
- lda (251),y
sta box'parameters,y
dey
bpl -
jmp frame'up
frame'entry lda #4
sta parm'count
frame'ii lda #0
sta temp
- jsr get'number
tya
ldy temp
sta box'parameters,y
inc temp
cpy parm'count
bne -
frame'up jsr linx
lda 214
pha
lda 211
pha
frame'start ldx box'parameters+2
ldy #0
clc
jsr plot
jsr old'rom'patch
;dec b